# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-cairosvg
_pyname=CairoSVG
pkgver=2.5.2
pkgrel=2
pkgdesc="Cairo-based SVG renderer for python"
url="https://cairosvg.org"
arch="noarch"
license="LGPL-3.0-or-later"
depends="
	python3 py3-tinycss2 py3-cssselect2 py3-defusedxml py3-cairocffi
	py3-webencodings
"
checkdepends="py3-pytest py3-pillow py3-pytest-flake8 py3-pytest-isort
	py3-pytest-cov py3-pytest-runner"
makedepends="python3-dev py3-setuptools cairo-dev py3-pytest-runner"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz
	python-cairosvg-disable-flake8-isort.patch"
builddir="$srcdir"/CairoSVG-$pkgver
replaces="py-cairosvg" # Backwards compat
provides="py-cairosvg=$pkgver-r$pkgrel" # Backwards compat

prepare() {
	mkdir test_non_regression/cairosvg_reference/
	cp -a $(ls -1 . | grep -v test_non_regression) test_non_regression/cairosvg_reference/
}

build() {
	python3 setup.py build
}

check() {
	python3 setup.py pytest -v
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="
070fbb549614401a7d8290497b0eb7702330ee264c5f625cd1e7aac4aea7d71ee7d2d8899297212e1a3c11c93903b191c0c699336d9000796318b11f4e075576  CairoSVG-2.5.2.tar.gz
842790d398ff200cdc0f148d61bff69b90c79e2da135fe2158fe250aeeeee04567fe7ff645ad9a7c0d6a0b2fcbe58a64eecf4c9f62bb5d8cc39cf57628d135c6  python-cairosvg-disable-flake8-isort.patch
"
